import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

/// @author zavier
/// @time 2022/6/22 11:06
/// @des 状态栏

class StatusBarUtils {
  static setTransparentBar({isDark = true}) {
    if (Platform.isAndroid) {
      // 设置系统的沉浸式UI效果--把状态栏变成透明
      SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle(
        statusBarColor: Colors.transparent,
        systemNavigationBarIconBrightness: isDark ? Brightness.dark : Brightness.light,
        statusBarIconBrightness: isDark ? Brightness.dark : Brightness.light,
        statusBarBrightness: isDark ? Brightness.dark : Brightness.light,
      );
      // 应用这个效果
      SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
    }
  }
}
